using System;
using System.Diagnostics;
using PT.Common;

namespace PT.Timing {
    public class ClickEventArgs : EventArgs {
        internal Click Click { get; private set; }

        public Rational NoteDuration {
            get { return Click.NoteDuration; }
        }

        public long ClickTimeTicks { get; private set; }
        public DateTime ClickTime { 
            get {
                var currentTimeT = Stopwatch.GetTimestamp();

                var diffSecs = (currentTimeT - ClickTimeTicks) / Stopwatch.Frequency;
                return DateTime.Now.Subtract( new TimeSpan( 0, 0, (int)diffSecs ) );
            }
        }
        public long EventRaisedTime { get; private set; }

        internal ClickEventArgs( Click clickEventData, long clickTime, long eventRaisedTime ) {
            Click = clickEventData;

            ClickTimeTicks = clickTime;
            EventRaisedTime = eventRaisedTime;
        }
    }
}